<?php 
require("admin-header.php");
require_once("../maincore.php");
if (!defined("THNOJ")) die ("Outside of the site");
echo "<title>Danh sách tin tức</title>";
echo "<center><h2>Danh sách tin tức</h2></center>";
$sql="select * FROM `news` where user_id='$myid' order by `news_id` desc";
$result=mysql_query($sql) or die(mysql_error());
echo "<center><table width=90% border=1>";

echo "<tr><td>Mã số<td>Tiêu đề<td>Ngày<td>Trạng thái<td>Lựa chọn</tr>";
for (;$row=mysql_fetch_object($result);){
	echo "<tr>";
	echo "<td>".$row->news_id;
	//echo "<input type=checkbox name='pid[]' value='$row->problem_id'>";
	echo "<td><a href='news_edit.php?id=$row->news_id'>".$row->title."</a>";
	echo "<td>".$row->time;
	echo "<td>".($row->defunct=="N"?"<span class=green>Sử dụng</span>":"<span class=red>Dự trữ</span>")." <a href='news_df_change.php?id=$row->news_id'><img src='../image/toggle.png' alt='[Đổi]' title='Hoán đổi'/></a>";
		echo "<td>[<a href=news_edit.php?id=$row->news_id>Sửa</a>]";
	
	echo "</tr>";
}

echo "</tr></form>";
echo "</table></center><br>";
echo "<center><a href='news_add_page.php'>Thêm mục tin tức mới</a></center>";
require("../oj-footer.php");
?>
